<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>js获取任意一天的开始时间和结束时间</title>
  <script src="../utils/index.js"></script>
</head>

<body>
  <script>
    let time = '2024-08-22';
    let date1 = dateFtt('yyyy-MM-dd HH:mm:ss', new Date(new Date(time).setHours(0, 0, 0, 0)));
    let date2 = dateFtt('yyyy-MM-dd HH:mm:ss', new Date(new Date(time).setHours(23, 59, 59, 999)));
    console.log(date1, date2); // 2024-08-22 00:00:00 2024-08-22 23:59:59
    let date3 = dateFtt('yyyy-MM-dd HH:mm:ss S', new Date(new Date(time).setHours(0, 0, 0, 0)));
    let date4 = dateFtt('yyyy-MM-dd HH:mm:ss S', new Date(new Date(time).setHours(23, 59, 59, 999)));
    console.log(date3, date4); // 2024-08-22 00:00:00 0 2024-08-22 23:59:59 999

    let m1 = new Date(date1).getTime();
    let m2 = new Date(date2).getTime();
    console.log(m1, m2, m2 - m1);



  </script>
</body>

</html>